package com.jdzy.student.controller;

import com.jdzy.model.common.vos.ResultA;
import com.jdzy.model.student.vos.AppointmentVo;
import com.jdzy.model.teacher.dtos.AppointmentsTDto;
import com.jdzy.student.service.AppointmentsService;
import io.swagger.annotations.Api;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;
import java.util.List;

@RestController
@CrossOrigin(allowCredentials = "true" , allowedHeaders = "*")
@Slf4j
@RequestMapping("api/appointments")
@Api(value = "预约的控制类")
@RequiredArgsConstructor
public class AppointmentsController {
    private final AppointmentsService appointmentsService;

    /**
     * 查询预约信息接口
     * @param teacherUsername
     * @return
     */
    @GetMapping("/teacherAppointments")
    public ResultA<List<AppointmentVo>> getTeacherAppointments(@RequestParam String teacherUsername) {
        return appointmentsService.getTeacherAppointments(teacherUsername);
    }
    /**
     * 教师选择学生预约的状态
     */
    @PostMapping("/updateStatus")
    public ResultA<String> updateStatus(@RequestBody AppointmentsTDto appointmentsTDto) {
        return appointmentsService.updateStatus(appointmentsTDto);
    }
    /**
     * 学生查看预约回复
     */
//    @GetMapping("/studentAppointments")
//    public ResultA<List<AppointmentVo>> getStudentAppointments(@RequestParam String stuId) {
////      return appointmentsService.getStudentAppointments(stuId);
//        return ResultA.ok();
//    }

}
